easyDSP uses an SCI interrupt to communicate with TMS320F28x. Therefore, the user program should include SCI ISR (Interrupt Service Routine) code which easyDSP provides.
C2000 series
SCI ISR files F28001x
F28002x
F28003x
F28004x
F2807x
F2837x
F2838x CPU1 and CPU2
F28P55x
F28P65xeasy28x_DriverLib_v11.2.c
easy28x_DriverLib_v11.2.hF2838x CM
easy28x_cm_DriverLib_v10.1.c
easy28x_cm_DriverLib_v10.1.hName and its role of key functions in ISR code is
easyDSP_SCI_Init() : Initializes SCI
easyDSP_UART_Init() : Initializes UART of TMS320F2838x CM
easy_RXINT_ISR() : ISR for RX_INT
easyDSP_Boot_Sync(void) : Multi core MCU (F2837xD, F2838xS and 2838xD) booting and synchronization
You SHOULD change some #define variables in the early part of the source accordingly to your target system. For example, below selection is targeting for F2807x + easyDSP communication @ 115200 bps.
#define F28002x 0
#define F28003x 0
#define F28004x 0
#define F2807x 1
#define F28P65xS 0
#define F28P65xD_CPU1 0
#define F28P65xD_CPU1_CPU2 0
#define F2837xS 0
#define F2837xD_CPU1 0
#define F2837xD_CPU1_CPU2 0
#define F2838xD_CPU1 0
#define F2838xD_CPU1_CM 0
#define BAUDRATE 115200LPlease note that DEVICE_LSPCLK_FREQ constant in device.h file should be matching to your system since SCI baudrate setting of easyDSP is based on that.
All variables in the ISR have prefix ‘ezDSP_ ’ . Please don ’ t change these variables during your easyDSP operation.
Interrupts are automatically disabled when an interrupt service routine begins. In other words, once easyDSP ISR has been executed, your higher priority ISR can't be executed until easyDSP ISR has been completed.
easyDSP source file provides buit-in interrupt nesting function assuming easyDSP SCI ISR has the lowest priority.
For further information about interrupt nesting, please check
http://processors.wiki.ti.com/index.php/Interrupt_Nesting_on_C28x
To run easyDSP ISR fast and stable when system is running on the flash, please use #pragma in the easyDSP header file. Please refer to TI application note for '.TI.ramfunc' section operation.
in the header file, easy28x_driverlib.h
#pragma CODE_SECTION(easy_RXINT_ISR, ".TI.ramfunc");
NOTE) Especially when your program runs on the flash and program/erase the flash at the same time with TI flash API, ISR of easyDSP should run on the ram, not on the flash. Any ISR routines that are executed during flash API function call must completely reside outside of the flash and must not expect to read data from the flash.
easyDSP requires appropriate interrupt settings to communicate with MCU. Below box shows its example. At first, please set up the other interrupts except SCI. Then, call easyDSP_SCI_Init(). In the call to the functions, related registers are set up for SCI communication and interrupts. Also please check main.c example file in the source/C2000/driverlib folder.
# include " easy28x_DriverLib_v11.2.h"
main(void) {
Device_init();
// below function should be called after other interrupts settings
easyDSP_SCI_Init();
while(1) {
}
}
Multi core programming for CPU1 and CPU2 : F28P65xD, F2837xD, F2838xS and
F2838xD
The use of header file and easyDSP_SCI_Init() function is same to that of single core MCU.
In addtion, easyDSP_Boot_Sync() function is required to boot and synchronize CPU2.
This function should be called in both CPU1 and CPU2 program. Pease check main.c example file in the source/C2000/DriverLib folder.
#include " easy28x_DriverLib_v11.2.h"
main(void) {
Device_init();
// called after Device_init() and before easyDSP_SCI_Init()
easyDSP_Boot_Sync();
easyDSP_SCI_Init();
while(1) {
}
}
The use of header file and easyDSP_UART_Init () function is similar to that of single core MCUs.
In addtion, easyDSP_Boot_Sync() function is required to boot and synchronize CM.
Pease check main_cm.c example file in the source/C2000/DriverLib folder.
#include " easy28x_cm_DriverLib_v10.1.h"
main(void) {
CM_init();
// called after CM_init() and before easyDSP_UART_Init()
easyDSP_Boot_Sync();
easyDSP_UART_Init();
while(1) {
}
}